package com.tancw.hession;

import javax.annotation.Resource;

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.remoting.caucho.HessianServiceExporter;
import org.springframework.stereotype.Component;

import com.tancw.Application;
import com.tancw.service.UserService;

@ConditionalOnClass(Application.class)
@Component
public class HessionPub {
    @Resource
    private UserService userService;

    @Bean(name = "/userService")
    public HessianServiceExporter find() {
        HessianServiceExporter exporter = new HessianServiceExporter();
        exporter.setService(userService);
        exporter.setServiceInterface(UserService.class);
        return exporter;
    }
}
